home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre2.z / postgre2 / ref / postquel / create < prev    next >
Encoding:
Text File  |  1992-08-27  |  4.3 KB  |  161 lines

  1. .\" XXX standard disclaimer belongs here....
  2. .\" $Header: /private/postgres/ref/postquel/RCS/create,v 1.8 1992/07/14 05:54:17 ptong Exp $
  3. .SP CREATE COMMANDS 6/14/90
  4. .XA 2 Create
  5. .uh NAME
  6. .lp
  7. create \*- create a new class
  8. .uh SYNOPSIS
  9. .lp
  10. .(l
  11. \fBcreate\fR classname (attributename = type { , attributename = type})
  12.     [\fBkey\fR (attributename [[\fBusing\fR] \fBoperator\fR]
  13.          { , attributename [[\fBusing\fR] \fBoperator\fR] } )]
  14.     [\fBinherits\fR \fB(\fR classname {\fB,\fR classname} \fB)\fR]
  15.     [\fBarchive\fR \fB=\fR archive_mode]
  16.     [\fBstore\fR \fB=\fR ``smgr name'']
  17.     [\fBarch_store\fR \fB=\fR ``smgr name'']
  18. .)l
  19. .uh DESCRIPTION
  20. .lp
  21. .b Create
  22. will enter a new class into the current data base.
  23. The class will be 
  24. .q "owned"
  25. by the user issuing the command.
  26. The name of the class is
  27. \fIclassname\fR
  28. and the attributes are as specified in the list of
  29. \fIattributenames:\fR
  30. \fIattributename, attributename,\fR
  31. etc.
  32. The attributes are created with the type specified by
  33. \fItype.\fR
  34. .lp
  35. The \fIkey\fR clause is used to specify that a field or a collection
  36. of fields is unique.
  37. If no key clause is specified, \*(PP will still give every instance
  38. a unique object-id
  39. .r ( \c
  40. .A OID ).
  41. This clause allows other fields to be additional keys.
  42. Moreover, the
  43. .q "using operator"
  44. part of the clause allows the user to specify what operator should
  45. be used for the uniqueness test.
  46. For example, integers are all unique if = is used for
  47. the check, but not if < is used instead.
  48. If no operator is specified, = is used by default.
  49. Any specified operator must be a binary operator returning a boolean.
  50. If there is no compatible index to allow the key clause to be
  51. rapidly checked, \*(PP defaults to not checking
  52. rather than performing an exhaustive search on each key update.
  53. .lp
  54. The
  55. \fIinherits\fR
  56. clause specifies a collection of class names
  57. from which this class automatically inherits all fields.
  58. If any inherited field name appears more than once,
  59. \*(PP reports an error.
  60. Moreover,
  61. \*(PP automatically allows the created class to inherit
  62. functions on classes above it in the
  63. inheritance hierarchy.
  64. Inheritance of functions is done according to the conventions of the
  65. Common Lisp Object System (CLOS).
  66. .lp
  67. In addition,
  68. .i classname 
  69. is automatically created as a type.  Therefore, one or more instances 
  70. from the class are automatically a type and can be used in 
  71. addattr or other create statements. 
  72. See 
  73. .b introduction
  74. (commands) for a further discussion of this point.
  75. .lp
  76. The
  77. .i store
  78. and
  79. .i arch_store
  80. keywords may be used to specify a storage manager to use
  81. for the new class.
  82. The released version of \*(PP supports only ``magnetic disk''
  83. as a storage manager name;
  84. the research system at Berkeley provides additional storage managers.
  85. .i Store
  86. controls the location of current data,
  87. and
  88. .i arch_store
  89. controls the location of historical data.
  90. .i Arch_store
  91. may only be specified if
  92. .i archive
  93. is also specified.
  94. If either
  95. .i store
  96. or
  97. .i arch_store
  98. is not declared,
  99. it defaults to ``magnetic disk.''
  100. .lp
  101. The class is created as a heap with
  102. no initial data.
  103. A class can have no more than 1600 domains (realistically,
  104. this is limited by the fact that tuple sizes must be less
  105. than 8K),
  106. but this limit may be configured lower at some sites.
  107. A class cannot have the same name as
  108. a system catalog class.
  109. .lp
  110. .i Archive
  111. specifies whether historical data is to be saved or discarded.
  112. .i Arch_mode 
  113. may be one of:
  114. .(l
  115. none:    no historical access is supported
  116. light:    historical access is allowed and optimized for light update activity
  117. heavy:    historical access is allowed and optimized for heavy update activity
  118. .)l
  119. and defaults to none.
  120. For details of the optimization, see
  121. [STON87].
  122. Once the archive status is set, there is no way to change it.
  123. .uh EXAMPLE
  124. .lp
  125. .nf
  126. .ft C
  127. .sp
  128. /* Create class emp with attributes name, sal and bdate */
  129.  
  130. create emp (name = char16, salary = float4, bdate = abstime)
  131. .ft
  132. .lp
  133. .nf
  134. .ft C
  135. .sp
  136. /* Create class permemp with pension information
  137.  * inheriting all fields of emp */
  138.  
  139. create permemp (plan = char16) inherits (emp)
  140. .ft
  141. .lp
  142. .nf
  143. .ft C
  144. .sp
  145. /* Create a class foo on mag disk,
  146.  * and archive historical data */
  147.  
  148. create foo (bar = int4) archive = heavy
  149.     store = "magnetic disk"
  150. .ft
  151. .fi
  152. .uh "SEE ALSO"
  153. .lp
  154. destroy(commands).
  155. .uh BUGS
  156. .lp
  157. Key is not implemented in Version \*(PV.
  158. .lp
  159. Optional specifications (inherits, archive, store)
  160. must be supplied in the order given above, if they are supplied at all.
  161.